#ifndef _EPOLL_MGR_H_
#define _EPOLL_MGR_H_

#include <sys/epoll.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <unistd.h>

#include <vector>

#include <server.hpp>

using namespace std;

class epoll_mgr {
private:
  int s_sock, epoll_fd;
  int res, res_fd;
  int client_count;
  const int PORT = 1025;
  const int MAX_CLIENTS = 10;
  vector<int> clients;
  struct sockaddr_in server_addr;
  struct sockaddr_in client_addr;
  struct epoll_event ev;
  struct epoll_event events[MAX_CLIENTS];
  server* s;
public:
  epoll_mgr(server* s);
  ~epoll_mgr();
  void add_sock_to_epoll(int sock);
  void event_loop();
  void remove_sock(int sock);
};

#endif
